package com.iot.websocket.message;

import com.alibaba.fastjson.JSONObject;
import com.iot.common.enums.BizCode;
import com.iot.websocket.Topic;
import com.iot.websocket.WebSocketMessage;

public class ClientStatisticsMessage extends WebSocketMessage {

    private Long deptId;

    public ClientStatisticsMessage() {
        this.setBizCode(BizCode.COMMON.getCode());
    }

    public static ClientStatisticsMessage getInstance(Long deptId, int onlineCount, int offlineCount){
        ClientStatisticsMessage instance = new ClientStatisticsMessage();
        instance.deptId = deptId;
        instance.setTopic(Topic.CLIENT_STATISTICS);
        JSONObject data = new JSONObject();
        data.put("onlineCount", onlineCount);
        data.put("offlineCount", offlineCount);
        instance.setData(data);
        return instance;
    }

    public Long getDeptId() {
        return deptId;
    }
}
